#ifndef WEIZHI_H
#define WEIZHI_H
#include <QGraphicsPixmapItem>
#include <QTimer>
#include <QKeyEvent>

//此头文件目前包含位置和角色
class weizhi
{
public:
    weizhi(int a=0,int b=0);
    int x_();
    int y_();
private:
    int x;
    int y;
};


class character : public QObject, public QGraphicsPixmapItem
{
    Q_OBJECT
public:

    explicit character (QGraphicsItem* parent=nullptr);
    void keyPressEvent(QKeyEvent *event) override;    // 正确重写按下事件




private:

    int vx,vy;//速度向量
    bool keyStates[256] = {false};//处理移动逻辑

    QPixmap c_a[4];   // 存储4帧动画
    int m_currenta = 0;
    QTimer* m_animationTimer;//动画定时器
};

#endif // WEIZHI_H
